/**
 * 文件名：RoleController.java
 * 创建时间：Jul 8, 20091:17:03 PM
 */
package com.lane.sidecn.security.web;

import com.lane.core.web.BaseController;
import com.lane.sidecn.security.model.Role;
import com.lane.sidecn.security.service.RoleManager;

/**
 * @author 忽吉烈
 *
 */
public class RoleController extends BaseController {

	private RoleManager roleManager;
	private Role role;
	
	/**
	 * 添加角色
	 */
	public void addRole()
	{
		try {
			roleManager.save(role);
			printMessage("addSuccess");
		} catch (Exception e) {
			e.printStackTrace();
			printMessage("addFail");
		}
		
	}
	
	/**
	 * 删除角色
	 */
	public void delRole()
	{
		roleManager.removeById(role.getRole_id());
		printMessage("delSuccess");
	}
	
	/**
	 * 更新角色
	 */
	public void updateRole()
	{
		try {
			roleManager.save(role);
			printMessage("updateSuccess");
		} catch (Exception e) {
			e.printStackTrace();
			printMessage("updateFail");
		}
	}
	public RoleManager getRoleManager() {
		return roleManager;
	}
	public void setRoleManager(RoleManager roleManager) {
		this.roleManager = roleManager;
	}
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
}
